
<template>
  <ex_dropdown_auto trigger="click" :url="url"
    :value="value" :urlParams="() => ({ customerId: customerId })" :dependentId="customerId" :urlControl="(params) => {
      if (params.customerId || isCustomerSystem) {
        return true
      } else {
        return {
          netStop: true,
          focusInnerData: [],
          warnning: $t('tip_please_select_first_customer'),
        }
      }
    }" :label="$t('label_select_address_info')"
    :option="(it) => ({ label: it['addressName'] + (it['addressDetail'] ? '/' + it['addressDetail'] : ''), value: it['id'] })"
    @command="selectQuickAddress" />
</template>

<script>
import role_system_mixin from "@/mixin/role_system_mixin";

export default {
  mixins: [role_system_mixin],

  name: 'base_area_select',
  data() {
    return {
      value: null,
      url: "",
    }
  },
  props: {
    customerId: null,
  },
  created() {
    if (this.isCustomerSystem) {
      this.url = "/oms-api/base/OmsBaseClientAddressRpc/queryClientList.json"
    } else if (this.isOmsSystem) {
      this.url = "/oms-api/base/OmsBaseClientAddressRpc/queryClientListByCustomerId.json"
    } else {
    }
  },

  methods: {
    selectQuickAddress(e){
      this.$emit('command',e)
    },
  },
}
</script>
<style lang="less" >
.el-dropdown-menu{
  max-height: 200px;
  overflow: auto;
}
</style>
